loglevel = 3

def logger(function):
    def wrapper():
        global loglevel
        if loglevel > 2:
            print "[DEBUG]"
        return function()
    return wrapper

def verbose(loglevel):
    def decorator(function):
        def wrapper(*args):
            if loglevel > 3:
                print "[DEBUG]"
            function(*args)
        return wrapper
    return decorator

@verbose(loglevel)
def createFile(filename, permissions=700):
    print "function: createFile " + filename
    print "          permissions", permissions

createFile("foo.xml", 755)

